-
-
Notifications
You must be signed in to change notification settings - Fork 436
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New feature: added partial postcode match to table rate shipping #1504
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting approach, I don't see any issues with it. Thanks for the PR!
I've rebased this to main and fixed the conflict, @colinmollenhour or somebody could you recheck/retest it please? |
Just a visual inspection but looks good. Minor optimization (I think), but couldn't this:
be replaced with this?
(in both places where this pattern is used) Is there anywhere this support for wildcards can be documented? Perhaps on the upload page form field? |
I was trying to test this PR but, when the checkout calculates the shipping costs I get: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens, query was: SELECT
|
This was missing from the submitted code: and adding it solved #1504 (comment) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After my changes I tested this PR and it work correctly (tested with *, partial match and full match)
Description (*)
Added partial postcode match to table rate shipping.
Needed to create shipping rules for Northern Ireland. Postcode should start with BT followed by anything else when the country is the UK. The only way possible in the old way was adding all possible exact postcodes. Now it is possible to add a wildcard asterix at the and of a partial postcode. For example BT* will match all postcodes starting with BT like BT1 1AA (a valid postcode from Northern Ireland). The same was already possible in the TAX rates zip/post code.
Related to issue: #1486
Related Pull Requests
#1503
Manual testing scenarios (*)
Questions or comments
The most specific postcode rule that is valid will be applied. So if you have the following postcodes for the same country and state:
And a customer places a order with "BT1 1BB" the line with "BT1*" will be applied. This is the most specific rule that matches because "BT1 1AA" doesn't match and "BT1*" is more specific than "BT*" and "*".
Contribution checklist (*)